# #求1~100的和
# theSum=0
# for i in range(1,101):
#     theSum+=i
# print(theSum)
#
# #求300~400的和
# theSum=0
# for i in range(300,401):
#     theSum+=i
# print(theSum)
#
# #求1~1000的和
# theSum=0
# for i in range(1,1000):
#     theSum+=i
# print(theSum)

#没有定义函数，同一个代码就需要重复写多次
# def caclSum(beg, end):
#     theSum=0
#     for i in range(beg,end+1):
#         theSum+=i
#     print(theSum)
#
#
# #求1~100的和
# caclSum(1, 100)
# #求300~400的和
# caclSum(300, 400)
# #求1~1000的和
# caclSum(1, 1000)

#函数的定义
# def test():
#     print('hello')
#     print('hello')
#
# #函数的调用
# test()


# def Add(x,y):
#     return x+y
#
#
# print(Add(10,20))
# print(Add(1.5,2.5))
# print("hello"," world")

#求1~100的和
# def calcSum(beg,end):
#     theSum=0
#     for i in range(beg,end+1):
#         theSum+=i
#     return theSum
#
#
# result=calcSum(1,100)
# print(result)


#判断一个数是否是偶数
# def isOdd(num):
#     if num%2==0:
#         return True
#     else:
#         return False
#
# print(isOdd(10))
# print(isOdd(19))

# def getPoint():
#     x=20
#     y=10
#     return x,y
#
#
# a,b=getPoint()
# print(a,b)
# _,d=getPoint()
# print(d)


# def getPoint():
#     x=10
#     y=20
#     return x,y
#
#
# x,y=getPoint()
# print(x,y)

# x=10
# def test():
#     x=20
#     print(f'打印函数内部的x={x}')
#
#
# test()
# print(f'打印函数外面的x={x}')

# x=10
# def test():
#     print(f'x={x}')
#
# test()

# x=10
# def test():
#     global x #说明该函数中的x是全局变量
#     x=20
#
#
# test()
# print(f'x={x}')

# def test():
#     print('函数体内执行语句')
#     print('函数体内执行语句')
#
#
# print('11111')
# test()
# print('22222')
# test()
# print('33333')
# test()
# print('44444')

# def isOdd(num):
#     if num % 2 == 0:
#         return True
#     else:
#         return False
#
# def Add(a,b):
#     return a+b
# #链式调用
# print(isOdd(Add(1,2)))


#一个简单的嵌套调用
# def test():
#     print('hello')


#求阶乘
# def factor(n):
#     result=1;
#     for i in range(1,n+1):
#         result*=i
#     return result

# def factor(n):
#     if n==1:
#         return 1
#     return n*factor(n-1)
#
#
# result=factor(5)
# print(result)

# def add(x,y,debug=False):
#     if debug:
#         print(f'x={x},y={y}')
#     return x+y
#
# print(add(1,2))

def test(x,y):
    print(f'x={x}')
    print(f'y={y}')


test(10,20)
test(x=10,y=20)
test(y=100,x=1)